package com.thomas.sdk.manager;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 线程池工具类
 * 
 * @author thomas
 * 
 */
public class ThreadPool {
	private ExecutorService service;

	private ThreadPool() {
		int num = Runtime.getRuntime().availableProcessors();
		service = Executors.newFixedThreadPool(num * 2);
	}

	private static final ThreadPool manager = new ThreadPool();

	public static ThreadPool getInstance() {
		return manager;
	}

	public void addTask(Runnable runnable) {

		service.execute(runnable);
	}
}
